﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ScrumTable.Common.SysLibs;

namespace ScrumTable.Tools.ErrorReporter
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            if( Environment.GetCommandLineArgs().Count( ) > 1)
            {
                ErrorText.Text = Environment.GetCommandLineArgs()[1];
            }
            //Icon = Application.Current.Resources["ExeLogo"] as BitmapImage;
        }

        private void OnRestartClick(object sender, RoutedEventArgs e)
        {
            var fileInfo = new FileInfo(Application.ResourceAssembly.Location).Directory.FullName + @"\ScrumTable.exe";
            if (File.Exists(fileInfo))
            {
                Process.Start(fileInfo);
            }
            Application.Current.Shutdown();
        }

        private void OnSendErrorClick(object sender, RoutedEventArgs e)
        {
            MAPI.SendErrorToScrumTable();
        }

        private void OnLeaveClick(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }
    }
}
